<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象</title>
    <script>
        // 方法一: 创建一个对象 用花括号{}
        var student = {
            userName: '小名',
            age: 24,
            address: '火星',
            A: function(name) {
                console.log('你好' + name);
            }
        }
        console.log(student.userName);
        student.A('小艾');

        //方法二: new Object();
        var obj = new Object();
        obj.userName = '小名';
        obj.age = 24;
        obj.address = '火星';
        obj.A = function(name) {
            console.log('你好' + name);
        }
        console.log(obj.age);
        obj.A('小红')
    </script>
</head>

<body>

</body>

</html>